1. Field of the Invention
The present invention relates to a language processing apparatus for converting a source program into an object program.
2. Description of the Related Art
For generating an object program for use in a computer system, it has been customary for a programmer to manually describe a source program and then for a language processing apparatus to convert the source program into an object program.
The language processing apparatus comprises a computer system which is operated by a compiler program, and converts the source program into the object program according to an appropriate algorithm.
As shown in FIG. 1 of the accompanying drawings, a source program 1 is generally of a structure having an array of functions 2 each containing a call instruction 3 described therein for calling another function 2.
When the source program 1 is converted into an object program by a language processing apparatus, the language processing apparatus executes a converting process with respect to each of the functions 2. Since the sequence of the functions 2 and the mutual calling relationship thereof are not changed while the source program 1 is being converted into an object program, the generated object program is of a structure which contains the functions 2 arranged in the same sequence as with the source program 1.
While the above language processing apparatus can convert a source program into an object program, the efficiency with which the functions 2 are called may be low because the sequence of the functions 2 in the generated object program is the same as that in the source program 1.
For example, when a certain function calls another function in an object program written in the language C, the function is called by different calls depending on the distance to the function. For example, if the distance across which the function is called is smaller than 64 kilobytes, then a relative branch call is executed, and if the distance across which the function is called is greater than 64 kilobytes, then an absolute address call is executed.
Since the absolute address call requires a longer call instruction code and is executed at a lower speed than the relative branch call, an object program with many absolute address calls is large in capacity and heavy. It would be practically difficult for the programmer to take special considerations to generate a source program containing relative branch calls as most function calls. Therefore, object programs of large capacity and low speed are actually generated.